package com.boc.ewr.util.file.enumeration;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.Optional;

/**
 * @author : Wzz
 * @create : 2023-06- 18- 16:42
 * @desc :	外包管理-日常问题-问题内容
 */
@Slf4j
public enum ProblemContentEnum {
    OUTSRC_LOST("1", "外包遗失"),
    FAKE("2", "虚假退信"),
    CUSM_COMPLAIN("3", "客户投诉"),
    CUSM_LOST("4", "客户遗失"),
    CUSM_NO_RECEIVE("5", "客户拒收"),
    CUSM_NO_SEND("6", "客户拒交");

    private String index;
    private String value;

    ProblemContentEnum(String index, String value){

        this.index = index;
        this.value = value;
    }

    /**
     * 根据value获取枚举对象
     *
     * @param val
     * @return
     */
    public static ProblemContentEnum getIndexByValue(String val) {
        Optional<ProblemContentEnum> first = Arrays.stream(ProblemContentEnum.values()).filter(e -> e.getValue().equals(val)).findFirst();
        ProblemContentEnum expEnum = first.orElse(null);
        log.info("选择的枚举类型是：" + expEnum.toString());
        return expEnum;
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
